package easy;

public class a28_实现strStr {
    public int strStr(String haystack, String needle) {
        if (haystack == "" || needle == "") {
            return -1;
        }
        int hay=haystack.length();
        int L=needle.length();
        for (int i=0;i<hay-L+1;i++){
            if(haystack.substring(i,i+L+1).equals(needle)){
                return i+1;
            }
        }
        return -1;
    }
}
